package com.googlecode.jmicroerp.wicket.administrare;

import com.googlecode.jmicroerp.model.Rol;
import com.googlecode.jmicroerp.model.Utilizator;
import com.googlecode.jmicroerp.service.GenericService;
import com.googlecode.jmicroerp.wicket.DefaultViewPage;
import com.googlecode.jmicroerp.wicket.components.grid.ActionButton;
import com.googlecode.jmicroerp.wicket.components.grid.ActionButtons;
import com.googlecode.jmicroerp.wicket.components.grid.ColumnModel;
import com.googlecode.jmicroerp.wicket.components.grid.DefaultGridAction;
import com.googlecode.jmicroerp.wicket.components.grid.Grid;
import com.googlecode.jmicroerp.wicket.components.grid.PageParameters;
import java.util.Arrays;
import java.util.List;
import org.apache.wicket.spring.injection.annot.SpringBean;

/**
 *
 * @author Alexandru.Codescu
 */
public class UtilizatoriViewPage extends DefaultViewPage {
    @SpringBean(name = "genericService")
    //private GenericService<Rol> rolService;
    private static final long serialVersionUID = 1L;
    //private List<Rol> roluri;
    @SpringBean(name = "defaultGridAction")
    private DefaultGridAction<Utilizator> defaultGridAction;

    public UtilizatoriViewPage() {
        ColumnModel[] gridModel = {
            new ColumnModel("Nume Utilizator", "numeUtilizator", String.class),
            //new ColumnModel("Rol", "roluri", String.class),
        };

        List<ColumnModel> columns = Arrays.asList(gridModel);

        PageParameters editPageParameters = new PageParameters(UtilizatoriEditPage.class);
        ActionButton actionButton = new ActionButton(editPageParameters);
        ActionButtons actionButtons = new ActionButtons(actionButton);
        Grid<Utilizator> dataGrid = new Grid<Utilizator>("grid", columns, Utilizator.class, defaultGridAction, actionButtons);

        add(dataGrid);
    }
}
